#pragma once

#include <vex/functional/make_raw_delegate.h>
#include <vex/core/intrusive_ptr_support.h>
#include <vex/core/as_intrusive.h>

namespace vex { namespace functional {
    template<class TSignature, class TFunction>
    auto make_intrusive_delegate(TFunction&& p_func)
        -> boost::intrusive_ptr< contract::delegate<TSignature> >
    {
        return as_intrusive_from_out(make_raw_delegate<TSignature>(
            std::forward<TFunction>(p_func)));
    }
}}